<a class="menu-toggler" id="menu-toggler" href="#">
    <span class="menu-text"></span>
</a>

<?php
$arrAyMenu = array(
   'default'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/default'),
        'icon'=>'<i class="icon-dashboard"></i>',
        'name'=>'<span class="menu-text"> Dashboard </span>'
        ),   
    ),
   'event'=>array(
    'parent'=> array(
        'link'=> '#',
        'icon'=>'<i class="icon-coffee"></i>',
        'name'=>'<span class="menu-text"> Events </span><b class="arrow icon-angle-down"></b>'
        ),   
    'submenu'=> array(
       'event_category'=>array(
        'link'=> Yii::app()->createUrl('bookingsystem/event/event_category'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Events Category'
        ),                             
       'index'=>array(
        'link'=> Yii::app()->createUrl('bookingsystem/event/index'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Events Management'
        ),                             
       ),   
    ),
   'eventlocked'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/eventlocked'),
        'icon'=>'<i class="icon-lock"></i>',
        'name'=>'<span class="menu-text"> Locked Event </span>'
        ),   
    ),
   'ticket'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/ticket'),
        'icon'=>'<i class="icon-fa-money fa fa-money fa-lg"></i>',
        'name'=>'<span class="menu-text"> Ticket </span>'
        ),   
    ),
   'gallery'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/gallery'),
        '<i class="icon-picture"></i>',
        'name'=>'<span class="menu-text"> Gallery </span>'
        ),   
    ),
// 'language'=>array(
//                'parent'=> array(
//                                'link'=>  Yii::app()->createUrl('bookingsystem/language'),
//                                'icon'=>'<i class="icon-book"></i>',
//                                'name'=>'<span class="menu-text"> Languages </span>'
//                           ),   
//            ),
//             'users'=>array(
//                            'parent'=> array(
//                                            'link'=>  Yii::app()->createUrl('bookingsystem/users'),
//                                            'icon'=>'<i class="icon-user"></i>',
//                                            'name'=>'<span class="menu-text"> Users Management </span>'
//                                       ),   
//                           ),
   'users'=>array(
    'parent'=> array(
        'link'=> '#',
        'icon'=>'<i class="icon-user"></i>',
        'name'=>'<span class="menu-text"> Manage User </span><b class="arrow icon-angle-down"></b>'
        ),   
    'submenu'=> array(
       'manageadmin'=>array(
        'link'=> Yii::app()->createUrl('bookingsystem/manageadmin'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Admin User'
        ),                             
       'users'=>array(
        'link'=> Yii::app()->createUrl('bookingsystem/users'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Customer User'
        ),                             
       ),   
    ),       


   'cms'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/cms'),
        'icon'=>'<i class="icon-credit-card "></i>',
        'name'=>'<span class="menu-text"> Cms Management </span>'
        ),   
    ),
   'emailtemplates'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/emailtemplates'),
        'icon'=>'<i class="icon-envelope-alt "></i>',
        'name'=>'<span class="menu-text"> Email Templates</span>'
        ),
    ),
   'booked'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/booked'),
        'icon'=>'<i class="icon-certificate "></i>',
        'name'=>'<span class="menu-text"> Booked Management</span>'
        ),
    ),
   'setting'=>array(
    'parent'=> array(
        'link'=>  Yii::app()->createUrl('bookingsystem/setting'),
        'icon'=>'<i class="icon-cogs"></i>',
        'name'=>'<span class="menu-text"> Settings </span>'
        ),   
    ),
   );

$htmlMenu       = '<li><a href="link">icon name </a></li>';
$htmlMenuParent = '<a href="" class="dropdown-toggle">iconpar';



?>



<div class="sidebar" id="sidebar">
    <ul class="nav nav-list">
        <?php
            if(count($arrAyMenu)>0):
                if(Yii::app()->user->role_id>2){
                   $arrAccess = MyFunctionCustom::$arrAcess;
                   $menuAccess= $arrAccess[Yii::app()->user->role_id]; 
                   $tmp =array();
                   if(count($menuAccess)>0): foreach ($menuAccess as $access):
                        $tmp[$access] = $arrAyMenu[$access];
                   endforeach;endif;
                   $arrAyMenu =$tmp;
                }

                foreach ($arrAyMenu as $menu):
                      if(!isset($menu['submenu'])){
                           echo str_replace(array('link','icon','name'),$menu['parent'],$htmlMenu);
                      }else{
                          echo "<li>";
                          echo '<a href="" class="dropdown-toggle">';
                          echo $menu['parent']['icon'] . $menu['parent']['name'];
                          echo '</a>';
                                  //submenu
                                  echo "<ul class='submenu'>";
                                  if(count($menu['submenu'])>0):
                                      foreach ($menu['submenu'] as $submenu):
                                             echo str_replace(array('link','icon','name'),$submenu,$htmlMenu);
                                      endforeach;
                                  endif;
                                  echo "</ul>";
                          echo "</li>";                       
                      }
                endforeach;
            endif;
        ?>
        
<!--        
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/default'); ?>">
                <i class="icon-dashboard"></i>
                <span class="menu-text"> Dashboard </span>
            </a>
        </li>
        <li>
            <a href="" class="dropdown-toggle">
                <i class="icon-coffee"></i>
                <span class="menu-text"> Events </span>
                <b class="arrow icon-angle-down"></b>
            </a>
            <ul class="submenu">
                <li>
                    <a href="<?php echo Yii::app()->createUrl('bookingsystem/event/event_category'); ?>">
                        <i class="icon-double-angle-right"></i>
                        Events Category
                    </a>
                </li>

                <li>
                    <a href="<?php echo Yii::app()->createUrl('bookingsystem/event/index'); ?>">
                        <i class="icon-double-angle-right"></i>
                        Events Management
                    </a>
                </li>
            </ul>
        </li>
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/ticket'); ?>">
                <i class="icon-fa-money fa fa-money fa-lg"></i>
                <span class="menu-text"> Ticket </span>
            </a>
        </li>
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/gallery'); ?>">
                <i class="icon-picture"></i>
                <span class="menu-text"> Gallery </span>
            </a>
        </li>
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/language'); ?>">
                <i class="icon-book"></i>
                <span class="menu-text"> Languages </span>
            </a>
        </li>
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/users'); ?>">
                <i class="icon-user"></i>
                <span class="menu-text"> Users Management </span>
            </a>
        </li>
        <li>
            <a href="<?php echo Yii::app()->createUrl('bookingsystem/setting'); ?>">
                <i class="icon-cogs"></i>
                <span class="menu-text"> Settings </span>
            </a>
        </li>-->
    </ul><!--/.nav-list-->

    <div class="sidebar-collapse" id="sidebar-collapse">
        <i class="icon-double-angle-left"></i>
    </div>
</div>